/*
============================================================================
 Name        : BaseInfoText.h
 Author      : 
 Version     :
 Copyright   : 
 Description : CBaseInfoText declaration
============================================================================
*/

#ifndef BASEINFOTEXT_H
#define BASEINFOTEXT_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "Block.h"
#include "BlockInfoTitle.h"
#include "Flickable.h"
// CLASS DECLARATION


class MInfoTextObserver
{
public:
	virtual TBool UpdateScreen() = 0;
};
class CFont;
/**
*  CBaseInfoText
* 
*/
class CBaseInfoText : public CBase, public MFlickableCallback
{
public:
	~CBaseInfoText();

	static CBaseInfoText* NewL(MInfoTextObserver* aObserver);

	static CBaseInfoText* NewLC(MInfoTextObserver* aObserver);

private:
	CBaseInfoText(MInfoTextObserver* aObserver);
	void ConstructL();

public:
	// from MFlickableCallback
	virtual TPoint ScrollOffset() const;

	virtual void SetScrollOffset(const TPoint& aOffset);

public:
	//from CBlock
	void OnDraw(CFbsBitGc& g)const;

	void OnKeyDown(TInt keyCode);

	//void InitData();
	
	void InitData(const TDesC& aText);

	void ChangeScrollPos(TInt nPos);

	void SizeChanged();

	TBool OnMouseDown(const TPoint& aPt);

	TBool OnMouseMove(const TPoint& aPt);

	TBool OnMouseUp(const TPoint& aPt);
	
	void ChangeFocus(TBool aFoucs, const TInt& keyCode);
public:
	inline void SetFocus(TBool b)	{iFocus	= b;}
	inline TBool Focus()	{return iFocus;}
protected:
	void AddTabs();
	
	void BeforeDraw(CFbsBitGc& g) const;
/*
public: // from MTabbarObserver
	void HandleTabbarCommand(TInt aCommand);*/
	
private:
	void SetScrollBar(TInt nPos, TInt nRange);

public:
	TInfo	m_info;
	HBufC*	m_strText;
	HBufC*	m_strTextTitle;
	
	/*TBool	m_isFromBengBeng;
	TInt	m_nBengBengMessage;
	TInt	m_nTotalBengBengMessage;
	TBool	m_needTitle;*/
	
	TInt	m_nLinesPerPage;
	TBool	m_bShowScroll;
	
	CScrollBar* m_sbVert;
	
	TRect m_rect;
private:
	CDesCArray* m_vTitle;
	CDesCArray* m_vText;

	TBuf<32> m_bufDownloading;
	TBuf<32> m_bufNoInfo;

	TInt iOffset;
	TInt iHeight;
	CFlickable* iFlickable;
	TInt iTotalLines;
	CFont* iFont;
	TBool iFocus;
	MInfoTextObserver* iObserver;
	TInt m_nLineHeight;

	mutable TInt iStartItem;
	mutable TInt iEndItem;
};

#endif // BlockInfoText_H
